﻿using System.Web;
using System.Xml;
using System;

using log4net;
/*	-----------------------------------------------------------------------	
	Copyright:	umlungu consulting (pty) ltd
	Author:		Alan Benington	
	Started:	2007-11-23	
	Status:		release	
	Version:	2.0.0
	Build:		20071123
	License:	GNU General Public License
	-----------------------------------------------------------------------	*/

/*	-----------------------------------------------------------------------	
	Development Notes:
	==================
	20071123:	Moved class from x_result file
	20071123:	Added constructors for logging and email alerts.
	-----------------------------------------------------------------------	*/

namespace umlungu.engineX.dataX {
	/// <summary>
	/// Specialised exception class.
	/// <para>This class is used to raise exceptions that have a code and message</para>
	/// </summary>
	public class DataXException : System.Exception {
		#region Invisible properties
		private static readonly ILog logger = LogManager.GetLogger(typeof(DataXException));
		#endregion

		#region Constants
		#endregion

		#region Visible properties
		private string code;
		/// <summary>The error code</summary>
		/// <value>Value of the error code allocated in construction of the exception</value>
		public string Code {
			get { return code; }
			set { code = value; }
		}
		#endregion

		#region Constructors/Destructors
		/// <overloads>Constructor</overloads>
		/// <summary>Default Constructor</summary>
		/// <param name="cde">Error code</param>
		/// <param name="message">Error message</param>
		public DataXException(string cde, string message) : base(message) {
			log4net.Config.XmlConfigurator.Configure();
			code = cde;
			logger.Info(cde, this);
		}
		#endregion

		#region Public methods
		#endregion

		#region Protected methods
		#endregion

		#region Private methods
		#endregion
	}
}
